<template>
  <div>
    <div class="lhxwjl-bt">技术负责人</div>
    <CustomTable
      ref="table"
      :showAlert="false"
      :showSelection="false"
      :columns="jsfzrColumns"
      :loading="load"
      @change="onTableChange"
      :dataSource="pageData"
      :pageSizeOptions="['5','10']"
      style="margin-top:10px;"
    >
     <!-- :scroll="{ y: 200 }" -->
      <template slot="xh" slot-scope="text, record, index">
        {{((pageFilter.pageNo - 1) * pageFilter.pageSize +(index + 1))>9?(pageFilter.pageNo - 1) * pageFilter.pageSize +(index + 1) :'0' + (index + 1) }}
      </template>
      <template slot="dateZchf" slot-scope="record">
        <span v-if="record!=='' && record!==null">{{ moment(record).format("YYYY-MM-DD") }}</span>
      </template>
    </CustomTable>
  </div>
</template>

<script>
import api from '@/api/index'
export default {
  props: {
    codeZzjg: {
      type: String
    }
  },
  data() {
    return {
      load: false,
      jsfzrColumns: [
        {
          title: "序号",
          dataIndex: "xh",
          key: "xh",
          width:80,
          scopedSlots: { customRender: "xh" }
        },
        {
          title: "姓名",
          dataIndex: "name",
          key: "name",
          ellipsis: true,
        },
        {
          title: "身份证",
          dataIndex: "idcard",
          key: "idcard",
          ellipsis: true,
          width: 150
        },
        {
          title: "职称",
          dataIndex: "zhicheng",
          key: "zhicheng",
          ellipsis: true,
        },
        {
          title: "证书编号",
          dataIndex: "zzzsh",
          key: "zzzsh",
          ellipsis: true,
        },
        {
          title: "核发单位",
          dataIndex: "zzhfjg",
          key: "zzhfjg",
          ellipsis: true,
        },
        {
          title: "核发日期",
          dataIndex: "dateZchf",
          key: "dateZchf",
          ellipsis: true,
          scopedSlots: { customRender: "dateZchf" }
        }
      ],
      pageData: [],
      pageFilter: {
        pageNo: 1,
        pageSize: 5,
        ryxxlb:'技术负责人',
        isPass:true,
      },
    };
  },
  created() {
    this.pageFilter.zzjgdm = this.codeZzjg;
    this.refreshTable();
  },
  methods: {
    onTableChange(pageFilter) {
      this.pageFilter = { ...this.pageFilter, ...pageFilter };
      this.refreshTable();
    },
    refreshTable() {
        this.load = true;
        api.get_ryxx_list(this.pageFilter) .then(res => {
          let pageNo = this.pageFilter.pageNo;
          let pageSize = this.pageFilter.pageSize;
          let records = res.rows;
          let total = res.total;
          this.pageData = {
            ...this.pageData,
            pageNo,
            records,
            pageSize,
            total
          };
          this.load = false;
            
        })
        .catch(err => {
          this.load = false;
        });
      },
  }
};
</script>

<style lang="less">
.lhxwjl-bt {
  color: #333333;
  font-size: 16px;
  font-weight: 400;
  margin-top: 20px;
  margin-left: 10px;
}
</style>